/*
 * @Author: your name
 * @Date: 2021-05-01 14:58:55
 * @LastEditTime: 2021-05-01 15:00:25
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \CodeBase\GraphQL\project1\apollo-server-express.js
 */
const express = require("express");
const { ApolloServer, gql } = require("apollo-server-express");
const typeDefs = gql`
  type Query {
    hello: String
  }
`;

const resolvers = {
  Query: {
    hello: () => "Sam",
  },
};

const server = new ApolloServer({ typeDefs, resolvers });
const app = express();
server.applyMiddleware({ app });
app.listen({ port: 4000 }, () =>
  console.log("now browsing to 4000 port" + server.graphqlPath)
);
